package me.minecraft.mod.cobblemonbukkitevent.bukkit.event;

import com.cobblemon.mod.common.api.battles.model.PokemonBattle;
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor;
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

/**
 * @author langle__
 * @version 1.0
 */
public class BattleForfeitEvent extends Event implements Cancellable {

    private static final HandlerList HANDLERS = new HandlerList();

    private final PokemonBattle battle;
    private final BattleActor forfeitingActor;
    private final BattlePokemon forfeitingPokemon;
    private final boolean before;

    private boolean cancel;

    public BattleForfeitEvent(PokemonBattle battle, BattleActor forfeitingActor, BattlePokemon forfeitingPokemon, boolean before) {
        this.battle = battle;
        this.forfeitingActor = forfeitingActor;
        this.forfeitingPokemon = forfeitingPokemon;
        this.before = before;
    }

    public PokemonBattle getBattle() {
        return battle;
    }

    public BattleActor getForfeitingActor() {
        return forfeitingActor;
    }

    public BattlePokemon getForfeitingPokemon() {
        return forfeitingPokemon;
    }

    public boolean isBefore() {
        return before;
    }

    @Override
    public boolean isCancelled() {
        return cancel;
    }

    @Override
    public void setCancelled(boolean cancel) {
        this.cancel = cancel;
    }

    @Override
    public @NotNull HandlerList getHandlers() {
        return HANDLERS;
    }

    public static HandlerList getHandlerList() {
        return HANDLERS;
    }

}